package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppCompanyEvaluationMapper;
import com.ep.modules.app.entity.AppCompanyEvaluation;
import com.ep.modules.app.entity.AppCompanyEvaluationExample;
import com.ep.modules.app.service.AppCompanyEvaluationService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppCompanyEvaluationServiceImpl implements AppCompanyEvaluationService {
    @Autowired
    private AppCompanyEvaluationMapper appCompanyEvaluationMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppCompanyEvaluationExample example = new AppCompanyEvaluationExample();
        AppCompanyEvaluationExample.Criteria criteria = example.createCriteria();
        List<AppCompanyEvaluation> list = appCompanyEvaluationMapper.selectByExample(example);
        Page<AppCompanyEvaluation> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppCompanyEvaluation getById(Long id) {
        return appCompanyEvaluationMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppCompanyEvaluation entity) {
        appCompanyEvaluationMapper.insert(entity);
    }

    public void update(AppCompanyEvaluation entity) {
        appCompanyEvaluationMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appCompanyEvaluationMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}